<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>tango.net.SocketConduit</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "tango.net.SocketConduit";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/tango.net.SocketConduit.html" class="symbol">tango.net.SocketConduit</a></h1>
  
<p class="sec_header">License:</p>BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a>
<p class="sec_header">Version:</p>Mar 2004 : Initial release
<p class="sec_header">Version:</p>Jan 2005 : RedShodan patch for timeout query
<p class="sec_header">Version:</p>Dec 2006 : Outback release
<p class="sec_header">Author:</p>Kris
<dl>
<dt class="decl">class <a class="symbol _class" name="SocketConduit" href="./htmlsrc/tango.net.SocketConduit.html#L32" kind="class" beg="32" end="364">SocketConduit</a> : Conduit; <a title="Permalink to this symbol" href="#SocketConduit" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L32">#</a></dt>
<dd class="ddef">
<div class="summary">A wrapper around the bare Socket to implement the IConduit abstraction
        and add socket-specific functionality.</div>
SocketConduit data-transfer is typically performed in conjunction with
        an IBuffer, but can happily be handled directly using void array where
        preferred
<dl>
<dt class="decl"><a class="symbol _ctor" name="SocketConduit.this" href="./htmlsrc/tango.net.SocketConduit.html#L50" kind="ctor" beg="50" end="53">this</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#SocketConduit.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L50">#</a></dt>
<dd class="ddef">
<div class="summary">Create a streaming Internet Socket</div></dd>
<dt class="decl"><a class="symbol _ctor" name="SocketConduit.this:2" href="./htmlsrc/tango.net.SocketConduit.html#L61" kind="ctor" beg="61" end="64">this</a><span class="params">(AddressFamily <em>family</em>, SocketType <em>type</em>, ProtocolType <em>protocol</em>)</span>; <a title="Permalink to this symbol" href="#SocketConduit.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L61">#</a></dt>
<dd class="ddef">
<div class="summary">Create an Internet Socket with the provided characteristics</div></dd>
<dt class="decl"><a class="symbol _ctor" name="SocketConduit.this:3" href="./htmlsrc/tango.net.SocketConduit.html#L72" kind="ctor" beg="72" end="75">this</a><span class="params">(AddressFamily <em>family</em>, SocketType <em>type</em>, ProtocolType <em>protocol</em>, bool <em>create</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.this:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L72">#</a></dt>
<dd class="ddef">
<div class="summary">Create an Internet Socket. See method allocate() below</div></dd>
<dt class="decl">char[] <a class="symbol _function" name="SocketConduit.toString" href="./htmlsrc/tango.net.SocketConduit.html#L83" kind="function" beg="83" end="86">toString</a><span class="params">()</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.toString" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L83">#</a></dt>
<dd class="ddef">
<div class="summary">Return the name of this device</div></dd>
<dt class="decl">Socket <a class="symbol _function" name="SocketConduit.socket" href="./htmlsrc/tango.net.SocketConduit.html#L94" kind="function" beg="94" end="97">socket</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#SocketConduit.socket" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L94">#</a></dt>
<dd class="ddef">
<div class="summary">Return the socket wrapper</div></dd>
<dt class="decl">uint <a class="symbol _function" name="SocketConduit.bufferSize" href="./htmlsrc/tango.net.SocketConduit.html#L105" kind="function" beg="105" end="108">bufferSize</a><span class="params">()</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.bufferSize" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L105">#</a></dt>
<dd class="ddef">
<div class="summary">Return a preferred size for buffering conduit I/O</div></dd>
<dt class="decl">Handle <a class="symbol _function" name="SocketConduit.fileHandle" href="./htmlsrc/tango.net.SocketConduit.html#L119" kind="function" beg="119" end="122">fileHandle</a><span class="params">()</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.fileHandle" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L119">#</a></dt>
<dd class="ddef">
<div class="summary">Models a handle-oriented device.</div>
<p class="sec_header">TODO:</p>figure out how to avoid exposing this in the general
                case</dd>
<dt class="decl">SocketConduit <a class="symbol _function" name="SocketConduit.setTimeout" href="./htmlsrc/tango.net.SocketConduit.html#L135" kind="function" beg="135" end="140">setTimeout</a><span class="params">(float <em>timeout</em>)</span>; <a title="Permalink to this symbol" href="#SocketConduit.setTimeout" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L135">#</a></dt>
<dd class="ddef">
<div class="summary">Set the read timeout to the specified interval. Set a
                value of zero to disable timeout support.</div>
The interval is in units of seconds, where 0.500 would
                represent 500 milliseconds. Use TimeSpan.interval to
                convert from a TimeSpan instance.</dd>
<dt class="decl">bool <a class="symbol _function" name="SocketConduit.hadTimeout" href="./htmlsrc/tango.net.SocketConduit.html#L148" kind="function" beg="148" end="151">hadTimeout</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#SocketConduit.hadTimeout" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L148">#</a></dt>
<dd class="ddef">
<div class="summary">Did the last operation result in a timeout?</div></dd>
<dt class="decl">bool <a class="symbol _function" name="SocketConduit.isAlive" href="./htmlsrc/tango.net.SocketConduit.html#L159" kind="function" beg="159" end="162">isAlive</a><span class="params">()</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.isAlive" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L159">#</a></dt>
<dd class="ddef">
<div class="summary">Is this socket still alive?</div></dd>
<dt class="decl">SocketConduit <a class="symbol _function" name="SocketConduit.connect" href="./htmlsrc/tango.net.SocketConduit.html#L170" kind="function" beg="170" end="174">connect</a><span class="params">(Address <em>addr</em>)</span>; <a title="Permalink to this symbol" href="#SocketConduit.connect" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L170">#</a></dt>
<dd class="ddef">
<div class="summary">Connect to the provided endpoint</div></dd>
<dt class="decl">SocketConduit <a class="symbol _function" name="SocketConduit.bind" href="./htmlsrc/tango.net.SocketConduit.html#L186" kind="function" beg="186" end="190">bind</a><span class="params">(Address <em>address</em>)</span>; <a title="Permalink to this symbol" href="#SocketConduit.bind" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L186">#</a></dt>
<dd class="ddef">
<div class="summary">Bind the socket. This is typically used to configure a
                listening socket (such as a server or multicast socket).
                The address given should describe a local adapter, or
                specify the port alone (ADDR_ANY) to have the OS assign
                a local adapter address.</div></dd>
<dt class="decl">SocketConduit <a class="symbol _function" name="SocketConduit.shutdown" href="./htmlsrc/tango.net.SocketConduit.html#L210" kind="function" beg="210" end="214">shutdown</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#SocketConduit.shutdown" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L210">#</a></dt>
<dd class="ddef">
<div class="summary">Inform other end of a connected socket that we're no longer
                available. In general, this should be invoked before close()
                is invoked
        
                The shutdown function shuts down the connection of the socket:</div>
-   stops receiving data for this socket. If further data 
                        arrives, it is rejected.
<p class="bl"/>
                    -   stops trying to transmit data from this socket. Also
                        discards any data waiting to be sent. Stop looking for 
                        acknowledgement of data already sent; don't retransmit 
                        if any data is lost.</dd>
<dt class="decl">void <a class="symbol _function" name="SocketConduit.detach" href="./htmlsrc/tango.net.SocketConduit.html#L226" kind="function" beg="226" end="234">detach</a><span class="params">()</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.detach" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L226">#</a></dt>
<dd class="ddef">
<div class="summary">Release this SocketConduit</div>
Note that one should always disconnect a SocketConduit 
                under normal conditions, and generally invoke shutdown 
                on all connected sockets beforehand</dd>
<dt class="decl">uint <a class="symbol _function" name="SocketConduit.read" href="./htmlsrc/tango.net.SocketConduit.html#L253" kind="function" beg="253" end="256">read</a><span class="params">(void[] <em>dst</em>)</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.read" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L253">#</a></dt>
<dd class="ddef">
<div class="summary">Read content from the socket. Note that the operation 
                may timeout if method setTimeout() has been invoked with 
                a non-zero value.</div>
Returns the number of bytes read from the socket, or
                IConduit.Eof where there's no more content available
<p class="bl"/>
                Note that a timeout is equivalent to Eof. Isolating
                a timeout condition can be achieved via hadTimeout()
<p class="bl"/>
                Note also that a zero return value is not legitimate;
                such a value indicates Eof</dd>
<dt class="decl">uint <a class="symbol _function" name="SocketConduit.write" href="./htmlsrc/tango.net.SocketConduit.html#L267" kind="function" beg="267" end="273">write</a><span class="params">(void[] <em>src</em>)</span>; <span class="attrs">[<span class="stc">override</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.write" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L267">#</a></dt>
<dd class="ddef">
<div class="summary">Callback routine to write the provided content to the
                socket. This will stall until the socket responds in
                some manner. Returns the number of bytes sent to the
                output, or IConduit.Eof if the socket cannot write.</div></dd>
<dt class="decl">uint <a class="symbol _function" name="SocketConduit.read:2" href="./htmlsrc/tango.net.SocketConduit.html#L283" kind="function" beg="283" end="325">read</a><span class="params">(void[] <em>dst</em>, uint delegate(void[]) <em>dg</em>)</span>; <span class="attrs">[<span class="prot">package</span>, <span class="stc">synchronized</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.read:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L283">#</a></dt>
<dd class="ddef">
<div class="summary">Internal routine to handle socket read under a timeout.
                Note that this is synchronized, in order to serialize
                socket access</div></dd>
<dt class="decl">SocketConduit <a class="symbol _function" name="SocketConduit.allocate" href="./htmlsrc/tango.net.SocketConduit.html#L336" kind="function" beg="336" end="351">allocate</a><span class="params">()</span>; <span class="attrs">[<span class="prot">package</span>, <span class="stc">synchronized</span>, <span class="stc">static</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.allocate" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L336">#</a></dt>
<dd class="ddef">
<div class="summary">Allocate a SocketConduit from a list rather than creating
                a new one. Note that the socket itself is not opened; only
                the wrappers. This is because the socket is often assigned
                directly via accept()</div></dd>
<dt class="decl">void <a class="symbol _function" name="SocketConduit.deallocate" href="./htmlsrc/tango.net.SocketConduit.html#L359" kind="function" beg="359" end="363">deallocate</a><span class="params">(SocketConduit <em>s</em>)</span>; <span class="attrs">[<span class="prot">private</span>, <span class="stc">synchronized</span>, <span class="stc">static</span>]</span> <a title="Permalink to this symbol" href="#SocketConduit.deallocate" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.net.SocketConduit.html#L359">#</a></dt>
<dd class="ddef">
<div class="summary">Return this SocketConduit to the free-list</div></dd></dl></dd></dl>
</div>
<div id="footer">
  <p>Copyright (c) 2004 Kris Bell. All rights reserved</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Fri Dec 26 04:03:53 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>